//
//  HomeSearchViewController.m
//  XYMaterial
//
//  Created by 肖扬 on 15/12/29.
//  Copyright © 2015年 肖扬. All rights reserved.
//

#import "HomeSearchViewController.h"
#import "homeVCCell.h"
@interface HomeSearchViewController ()

@end

@implementation HomeSearchViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:UIColorFromRGB(0xf3f2f2)];
    self.mainTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, SWIDTH, VHEIGHT+64) style:UITableViewStylePlain];
    [self.mainTableView setDataSource:self];
    [self.mainTableView setDelegate:self];
    [self.mainTableView setBackgroundColor:[UIColor clearColor]];
    UIView *theView = [[UIView alloc] initWithFrame:self.mainTableView.frame];
    [theView setBackgroundColor:[UIColor clearColor]];
    [self.mainTableView setBackgroundView:theView];
    [self.view addSubview:self.mainTableView];
    // Do any additional setup after loading the view.
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 0;
}
// 返回哪一组的哪一行显示什么内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString* cellId = [NSString stringWithFormat:@"cellid%ld",(long)indexPath.row];
    homeVCCell* cell = (homeVCCell*)[tableView dequeueReusableCellWithIdentifier:cellId];
    
    if(cell == nil){
        cell = [[homeVCCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId] ;
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    }
    homeModelSupply *supply = [self.mainData objectAtIndex:indexPath.row];
    [cell drawCellView:supply];
    return cell;
}
// 当每一行的cell的高度不一致的时候就使用代理方法设置cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 104;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
